package com.sjp.demo.dubbo.consumer.controller;

import com.sjp.demo.dubbo.api.response.BaseResponse;
import com.sjp.demo.dubbo.api.service.IDubboItemService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestController {

    @Reference(version = "${demo.service.version}")
    private IDubboItemService itemService;

    @GetMapping("/dubbo")
    public BaseResponse testDubbo() {
        BaseResponse response = itemService.listItems();
        return response;
    }
}
